home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hardcore Gamer Resource Kit
/
Hardcore Gamer Resource Kit - Disc 3.iso
/
screensavers
/
saver25.zip
/
SOURCE.ZIP
/
Drawwnd.cpp
next >
Wrap
C/C++ Source or Header
|
1997-07-21
|
2KB
|
97 lines
// drawwnd.cpp : implementation file
//
#include "stdafx.h"
#include "Saver.h"
#include "drawwnd.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
LPCTSTR CDrawWnd::m_lpszClassName = NULL;
/////////////////////////////////////////////////////////////////////////////
// CDrawWnd
CDrawWnd::CDrawWnd(BOOL bAutoDelete)
{
init=0;
m_bAutoDelete = bAutoDelete;
}
CDrawWnd::~CDrawWnd()
{
}
BEGIN_MESSAGE_MAP(CDrawWnd, CWnd)
//{{AFX_MSG_MAP(CDrawWnd)
ON_WM_PAINT()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDrawWnd message handlers
void CDrawWnd::OnPaint()
{
if(!init) // first message is for window updates
{
CPaintDC dc(this); // device context for painting
CBrush brush(RGB(0,0,0));
CRect rect;
GetClientRect(rect);
dc.FillRect(&rect, &brush);
init++;
}
// else
{
probe.run();
Sleep(4);
Invalidate(FALSE);
}
// Do not call CWnd::OnPaint() for painting messages
}
int CDrawWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
BOOL CDrawWnd::Create(DWORD dwExStyle, DWORD dwStyle, const RECT& rect,
CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// Register a class with no cursor
if (m_lpszClassName == NULL)
{
m_lpszClassName = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW,
::LoadCursor(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDC_NULLCURSOR)));
}
dwStyle |= WS_VISIBLE;
/*
int x1, y1;
x1=(rect.right-rect.left-640)/2; if(x1<0) x1=0;
y1=(rect.bottom-rect.top-480)/2; if(y1<0) y1=0;
*/
return
CreateEx(dwExStyle, m_lpszClassName, _T(""), dwStyle,
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
pParentWnd->GetSafeHwnd(), NULL, NULL );
}
void CDrawWnd::PostNcDestroy()
{
if (m_bAutoDelete)
delete this;
}
/****************************************************************************/